package common.com.androidbase.datarequest.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.android.sohu.sdk.common.toolbox.MapUtils;
import com.common.sdk.net.connect.http.DaylilyRequest;
import com.common.sdk.net.connect.http.NetworkResponseEx;

import java.util.HashMap;
import java.util.Map;

import common.com.androidbase.R;

/**
 * Created by sangchengjiang on 16/9/6.
 */
public class DataResponseDetail extends RelativeLayout {

//    private DataSession mDataSession;

    private TextView errorView;

    private TextView apiContent;
    private TextView httpCodeContent;
    private TextView statusCodeContent;
    private TextView statusTextContent;
    private TextView jsonContent;
    private ImageView closeView;

    private MapView paramView;
    private MapView headerView;

    public DataResponseDetail(Context context) {
        super(context);
        init(context);
    }

    public DataResponseDetail(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context);
    }

    private void init(Context context) {
        inflate(context, R.layout.layout_http_error, this);
        apiContent = (TextView) findViewById(R.id.tv_api_content);
        errorView = (TextView) findViewById(R.id.tv_error);
        httpCodeContent = (TextView) findViewById(R.id.tv_http_code_content);
        statusCodeContent = (TextView) findViewById(R.id.tv_status_code_content);
        statusTextContent = (TextView) findViewById(R.id.tv_status_text_content);
        jsonContent = (TextView) findViewById(R.id.tv_json_content);
        closeView = (ImageView) findViewById(R.id.iv_close);

        closeView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                setVisibility(GONE);
            }
        });

        paramView = (MapView) findViewById(R.id.vw_param);
        headerView = (MapView) findViewById(R.id.vw_header);
    }

    public void setError(String error) {
        errorView.setText(error);
    }

}
